package com.example.HeadFirstDemo.observe.selfImpl;

public class ObserveDisplaySecond implements Observe {
    /*
    @parm subject;记录一下相关的subject
     */
    private Subject subject;
    private MessageData messageData;
    public ObserveDisplaySecond(MessageData messageData) {
        this.messageData=messageData;
        messageData.register(this);
    }

    public void display() {
        System.out.println("ObserveDisplaySecond is displaying" );
    }

    public void update(Subject subject) {
        System.out.println("Subject:"+subject+" is updating");
        this.display();
    }
}
